home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / rexx / xdmd1.lha / Paginate.man < prev    next >
Text File  |  1994-10-29  |  26KB  |  626 lines

  1.  
  2.  
  3.  
  4.        Paginate V1.00             User Manual             Paginate V1.00
  5.  
  6.        NAME
  7.            Paginate - Can do both pagination and line numbering on
  8.                       files.
  9.  
  10.        SYNOPSIS
  11.            Paginate <infile >outfile -F/K -f0/K -f1/K -ff/K -H/K -h0/K
  12.            -h1/K -hf/K -N/K -t/K/N -b/K/N -l/K/N -r/K/N -p/K/N -T/S
  13.  
  14.                -F      Default Format String for Footers
  15.                -f0     Format String for Even Paged Footers
  16.                -f1     Format String for Odd Paged Footers
  17.                -ff     Format String for Footer on First Page
  18.                -H      Default Format String for Headers
  19.                -h0     Format String for Even Paged Headers
  20.                -h1     Format String for Odd Paged Headers
  21.                -hf     Format String for Header on First Page
  22.                -N      Printf Style Format String for Line Numbering
  23.                -t      Top Line for Each Page
  24.                -b      Bottom Line for Each Page
  25.                -l      Left Margin for Headers and Footers
  26.                -r      Relative Right Margin for Headers and Footers
  27.                -p      Number of First Page
  28.                -T      Title Page
  29.  
  30.        COPYRIGHT
  31.            Paginate Copyright (C) 1993 Fergus Duniho
  32.  
  33.        DESCRIPTION
  34.            This program can do both pagination and line numbering on
  35.            files.
  36.  
  37.            PAGINATION
  38.  
  39.                The pagination involves breaking  a  text  file  up  into
  40.                pages of equal length, and optionally marking  each  page
  41.                with a header, a footer, or both. The headers and footers
  42.                may contain the page number in various formats,  as  well
  43.                as the time and date in various formats.  They  may  also
  44.                include any other text you want to put in them.
  45.  
  46.                You may choose different headers and footers for odd  and
  47.                even pages, as well as for the first page. You  may  also
  48.                choose to have no header or footer on the first page,  on
  49.                odd pages, or on even pages. And you may choose  to  have
  50.                the same footer or header on all pages.
  51.  
  52.                You may also choose to make the first page a title  page.
  53.                A title page has no headers  and  footers  on  it.  Also,
  54.                "Paginate" does not begin page  numbering  with  a  title
  55.                page. And as far as the headers and footers for the first
  56.  
  57.        Page 1                                            Tue 27 Apr 1993
  58.  
  59.  
  60.  
  61.        Paginate V1.00             User Manual             Paginate V1.00
  62.  
  63.                page are concerned, "Paginate" does not regard the  title
  64.                page as the first page. It considers it as the page prior
  65.                to the first page.
  66.  
  67.            LINE NUMBERING
  68.  
  69.                The line numbering consists of printing a string with the
  70.                line number in it at the beginning of each line. You  may
  71.                choose the format of the line number,  and  you  may  put
  72.                other text in the line number string. The default  is  to
  73.                do no line numbering.
  74.  
  75.        DEFAULT
  76.            Paginate -F "@C- #d -" -H "" -N "" -l 9 -r 65 -t 4 -b 57 -p 1
  77.  
  78.        USAGE
  79.            Paginate reads from standard input  and  writes  to  standard
  80.            output. So, to use it with files, you have to use redirection
  81.            operators. The simplest way to use "Paginate" is without  any
  82.            arguments, and it may look like this:
  83.  
  84.            > Paginate <infile >outfile
  85.  
  86.            This will paginate a file such that you get one inch  margins
  87.            on all sides when you print it, or at least such that I  will
  88.            when I print it on a laser printer I have access to. It  will
  89.            also center the page number at the bottom of each  page.  And
  90.            the page number will be in decimal form surrounded by a  pair
  91.            of hyphens like so: "- 1 -".
  92.  
  93.            You can change Paginate's behavior by  specifying  arguments.
  94.            You may include arguments on the command line in  any  order.
  95.            You must identify  each  argument  with  an  identifier  that
  96.            begins  with  a  hyphen.  You  can  see  these  listed  under
  97.            SYNOPSIS.
  98.  
  99.        FORMAT STRINGS
  100.            The arguments for headers, footers, and  line  numbering  are
  101.            format strings. The format strings may consist  of  text  and
  102.            conversion specifier. A conversion specifier is a bit of text
  103.            that gets replaced by other text, such as a  page  number  or
  104.            line number. The format strings for headers and  footers  may
  105.            also include formatting codes.
  106.  
  107.            CONVERSION SPECIFIERS FOR LINE NUMBERING
  108.                Paginate uses printf() for line numbering. Since Paginate
  109.                uses the line  number  as  the  only  other  argument  in
  110.                printf() besides the format string, the format string for
  111.                line numbering may include only one conversion specifier.
  112.                This conversion specifier must  be  one  which  turns  an
  113.  
  114.        Page 2                                            Tue 27 Apr 1993
  115.  
  116.  
  117.  
  118.        Paginate V1.00             User Manual             Paginate V1.00
  119.  
  120.                integer into a string. Here are the allowable  conversion
  121.                specifiers for line numbering:
  122.  
  123.                %c     - unsigned char
  124.                %d, %i - decimal integer
  125.                %o     - octal integer
  126.                %u     - unsigned decimal integer
  127.                %x, %X - unsigned hexadecimal integer
  128.  
  129.                Some of these, such  as  %c,  may  be  useless  for  page
  130.                numbering, but they're provided  anyway,  since  printf()
  131.                provides them.
  132.  
  133.                If you know how many lines your document has, your output
  134.                will look best if put a number between the '%'  character
  135.                and the character that follows  it.  For  example,  "%3d"
  136.                will print all your line numbers in a space with a  width
  137.                of 3. See a description of printf() in any book on C  for
  138.                more details.
  139.  
  140.            CONVERSION SPECIFIERS FOR HEADERS AND FOOTERS
  141.                Paginate does not use printf() for headers  and  footers.
  142.                Instead, it uses strftime() plus some  other  conversions
  143.                that I wrote myself.  This  is  because  I  wanted  roman
  144.                numeral page numbers, and printf() does not provide  this
  145.                feature. For the headers and  footers,  Paginate  accepts
  146.                conversion specifiers for the date,  the  time,  and  the
  147.                page number.
  148.  
  149.                The conversion specifiers it uses for the date  and  time
  150.                are the same as those used by the C function  strftime().
  151.                Depending upon what compiler  was  used  to  compile  the
  152.                version of Paginate you have  available,  the  conversion
  153.                specifiers for date and time may vary.  As  long  as  the
  154.                compiler adhered strictly to the ANSI standard, here  are
  155.                the conversion specifiers you may expect to use  for  the
  156.                date and time:
  157.  
  158.                %a - abbreviated weekday name
  159.                %A - full weekday name
  160.                %b - abbreviated month name
  161.                %B - full month name
  162.                %c - date and time
  163.                %d - day of the month
  164.                %H - hour of the 24-hour day
  165.                %I - hour of the 12-hour day
  166.                %j - day of the year, from 001
  167.                %m - day of the month, from 01
  168.                %p - AM/PM indicator
  169.                %S - seconds after the minute
  170.  
  171.        Page 3                                            Tue 27 Apr 1993
  172.  
  173.  
  174.  
  175.        Paginate V1.00             User Manual             Paginate V1.00
  176.  
  177.                %U - Sunday week of the year, from 00
  178.                %w - day of the week, from 0 for Sunday
  179.                %W - Monday week of the year, from 00
  180.                %x - date
  181.                %X - time
  182.                %y - year of the century, from 00
  183.                %Y - year
  184.                %Z - time zone name, if any
  185.  
  186.                According to the tests I  have  done  on  the  strftime()
  187.                function in DICE, which  I  compiled  the  Amiga  version
  188.                with, "%W" might mean something else, since  it  gives  a
  189.                value of 1 for April 27.  The  others  seem  to  work  as
  190.                expected.
  191.  
  192.                Paginate  also  understands  the   following   conversion
  193.                specifiers for the page number:
  194.  
  195.                #d - page number in decimal
  196.                #o - page number in octal
  197.                #x - page number in hexadecimal
  198.                #b - page number in binary
  199.                #r - page number in lowercase roman numerals
  200.                #R - page number in uppercase roman numerals
  201.  
  202.                Because paginate uses the number  sign  (#)  and  percent
  203.                sign (%) for conversion specifiers, and because  it  uses
  204.                the at sign (@) for formatting codes (see below), it also
  205.                recognizes the following conversion specifiers:
  206.  
  207.                %% - percent character %
  208.                ## - number sign (pound sign, octothorp, etc.) #
  209.                @@ - at sign @
  210.  
  211.                Unlike the conversion specifiers for line numbering,  the
  212.                conversion specifiers for headers and footers do not have
  213.                all the  features  that  printf()  conversion  specifiers
  214.                have.
  215.  
  216.            FORMATTING CODES
  217.                Paginate uses formatting codes to position  text  in  the
  218.                headers  and  footers.  It  understands   the   following
  219.                formatting codes:
  220.  
  221.                @L - left align text
  222.                @C - center text
  223.                @R - right align text
  224.  
  225.                If you do not  use  any  formatting  codes,  the  default
  226.                behavior will be to left align the text. You can use  all
  227.  
  228.        Page 4                                            Tue 27 Apr 1993
  229.  
  230.  
  231.  
  232.        Paginate V1.00             User Manual             Paginate V1.00
  233.  
  234.                three of these formatting codes within a  format  string.
  235.                This allows you to have  some  text  left  aligned,  some
  236.                centered, and  some  right  aligned.  The  scope  of  any
  237.                formatting code extends only up  until  the  end  of  the
  238.                string or the next formatting code. So, in something like
  239.                "@C#R@Ltitle@Rauthor", you get a header  or  footer  that
  240.                looks something like this:
  241.  
  242.                title                      I                       author
  243.  
  244.                Paginate also recognizes formatting codes  which  consist
  245.                of an at sign (@), an optional  minus  sign  (-),  and  a
  246.                lowercase hexadecimal digit. These are used  for  placing
  247.                text at specific positions in headers and  footers.  They
  248.                work by  adding  to  or  substracting  from  the  current
  249.                position. For example, "@R@-a" will begin text ten places
  250.                to the left of the right  margin.  "@C@0"  will  begin  a
  251.                piece of text right at the center. They may also be  used
  252.                more than once together. For example, "@L@9@f" will begin
  253.                text at position 25, because "@L" sets the position to 1,
  254.                "@9" adds nine to that, and "@f" adds fifteen more.
  255.  
  256.                Please note that "@C@0text" will not  work  the  same  as
  257.                "@Ctext". Both "@C" and "@R" work by determing the length
  258.                of the text segment  that  follows,  and  they  use  that
  259.                length to determine a cursor position to begin  the  text
  260.                at. When another formatting code immediately follows "@C"
  261.                or "@R", Paginate calculates  a  position  for  a  string
  262.                whose length is zero. Thus, "@C@0text"  begins  the  word
  263.                "text" at the center, whereas "@Ctext" centers  the  word
  264.                "text".
  265.  
  266.        EXAMPLES
  267.  
  268.            > Paginate <infile >outfile -F "" -H "@RPage ###d"
  269.  
  270.            This turns off all footers, and it puts on each page a header
  271.            that includes the page number on the right  side.  The  right
  272.            aligned text for the header on  the  first  page  looks  like
  273.            this: "Page #1".
  274.  
  275.            > Paginate <infile >outfile -f0 "" -f1 "" -hf "" -H
  276.            "Title@RPage#d"
  277.  
  278.            This turns off the footer for odd and even pages, but not for
  279.            the first page. It sets a default value for the  header,  and
  280.            it turns the header off for the first page. So, it  puts  the
  281.            page number in a footer on the first page, and  it  puts  the
  282.            page number in a header on all subsequent pages. Each  header
  283.            has the word "Title" left aligned and the page  number  right
  284.  
  285.        Page 5                                            Tue 27 Apr 1993
  286.  
  287.  
  288.  
  289.        Paginate V1.00             User Manual             Paginate V1.00
  290.  
  291.            aligned.
  292.  
  293.            > Paginate <infile >outfile -l 1 -F "" -H "Page #R" -h0
  294.            "@RPage #R"
  295.  
  296.            This sets the left margin to 1, turns  off  the  footer,  and
  297.            prints alternate headers on odd and even pages. On odd pages,
  298.            it left aligns the page number, and on even pages,  it  right
  299.            aligns the page number.
  300.  
  301.            > Paginate <infile >outfile -T -F "" -ff "@CPage #r" -h0
  302.            "Page #r" -h1 "@RPage #r"
  303.  
  304.            This creates a title page, on which there are no  headers  or
  305.            footers. It counts the second page as page #1, and it centers
  306.            the page number in a footer for that page. It puts  the  page
  307.            number in a header on all subsequent pages.  It  left  aligns
  308.            the page number on even pages and  right  aligns  it  on  odd
  309.            pages. It prints the page number in lowercase roman numerals.
  310.  
  311.            > Paginate <Paginate.man >P.man -F "Page #d@R%a %d %b
  312.            %Y" -H "Paginate V1.00@CUser Manual@RPaginate V1.00"
  313.  
  314.            These are the parameters I  chose  to  paginate  this  manual
  315.            with. Just take a look at the headers  and  footers  in  this
  316.            manual to see the results.
  317.  
  318.            > Type *.h | Paginate >headers -N "%3d " -H "Header
  319.            Files@RPage #d" -F "" -l 5 -r 70
  320.  
  321.            This example shows how  you  can  use  Paginate  on  multiple
  322.            files. By typing a bunch of files  to  standard  output  with
  323.            'type', you  can  use  a  pipe  to  redirect  the  output  to
  324.            Paginate. It puts a header on each page, and it numbers  each
  325.            line. It aligns the header with the text rather than with the
  326.            line numbers. (Changing the 5 after '-l' to a 1  would  align
  327.            the header with the line numbers.)
  328.  
  329.        DETAILS
  330.            Paginate gets the time only once. This means that it will not
  331.            print different times on different pages.
  332.  
  333.            Paginate does not begin page numbering with the  title  page.
  334.            So, if you include a title page, and you want page  numbering
  335.            to start on page number 1, the first page  number  should  be
  336.            set to 1 rather than to 0. This convention is different  from
  337.            what I have seen on ProWrite.
  338.  
  339.            Paginate puts a formfeed at the end of each page.
  340.  
  341.  
  342.        Page 6                                            Tue 27 Apr 1993
  343.  
  344.  
  345.  
  346.        Paginate V1.00             User Manual             Paginate V1.00
  347.  
  348.            Whenever Paginate finds a formfeed in  your  input  file,  it
  349.            recognizes that it has come to the end of a page.  If  it  is
  350.            supposed to put a footer on that page, it  inserts  linefeeds
  351.            until it reaches the bottom of the page, inserts the  footer,
  352.            and then inserts a formfeed. If it isn't supposed  to  put  a
  353.            footer on that page, it just inserts a formfeed and  goes  on
  354.            to the next page.
  355.  
  356.            Paginate puts the header on the line indicated by  "-t",  and
  357.            it puts the footer on the line indicated by "-b". When a page
  358.            doesn't expect a header or footer, Paginate puts  a  line  of
  359.            text where the header or footer would go. Thus, a page with a
  360.            header and footer on it has fewer lines of text than the same
  361.            page without the header and footer.
  362.  
  363.            Paginate always separates each header  and  footer  from  the
  364.            text by a blank line.
  365.  
  366.            The length of any format string  should  at  no  time,  which
  367.            means after conversions as well as initially, be longer  than
  368.            the value set by "-r", which is 65 by default.
  369.  
  370.            Rather than specifying the value of the  right  margin,  "-r"
  371.            specifies how far the right margin is from the  left  margin.
  372.            This is because Paginate never  used  the  right  margin  for
  373.            anything but finding the  difference  between  the  left  and
  374.            right margins.
  375.  
  376.            This gives you the added advantage of being able to play with
  377.            the left margin value without regularly  changing  the  right
  378.            margin value to keep the difference the same.
  379.  
  380.            The leftmost left margin is 1, not 0.
  381.  
  382.            The topmost top line is 1, not 0.
  383.  
  384.            All the conversion specifiers and formatting codes  are  case
  385.            sensitive. For example, "@C"  instructs  Paginate  to  center
  386.            some text, whereas "@c" instructs Paginate to place  text  12
  387.            spaces to the right of its current position in  a  header  or
  388.            footer.
  389.  
  390.        COMPILING
  391.            Paginate is written completely in ANSI C. Although I wrote it
  392.            on the Amiga, it does not use any  Amiga  specific  features.
  393.            You should be able to compile it on any machine with an  ANSI
  394.            C compiler.
  395.  
  396.            Please note that the Amiga version of GCC  2.3.3  has  a  bug
  397.            which causes this program to go  into  an  infinite  loop.  I
  398.  
  399.        Page 7                                            Tue 27 Apr 1993
  400.  
  401.  
  402.  
  403.        Paginate V1.00             User Manual             Paginate V1.00
  404.  
  405.            don't know if other versions of GCC have this same problem.
  406.  
  407.        HISTORY
  408.            I first needed a pagination program when I began  writing  my
  409.            essays  with  dme  instead  of  with  my  word  processor.  I
  410.            preferred  dme  because  it  was   faster   and   much   more
  411.            customizable, but it didn't have all the nice  features  that
  412.            my word processor had, including pagination.
  413.  
  414.            My first  pagination  program  was  an  ARexx  script  called
  415.            Paginate.dme. This would put some lines at the beginning of a
  416.            page, and it would center the line number at  the  bottom  of
  417.            the page. It would let me control such  parameters  as  first
  418.            page number and number of lines per page.
  419.  
  420.            When I began writing XDMD, the soon to be released  successor
  421.            of  DMD,  I  decided  that  I  wanted  something  better.   I
  422.            downloaded Pager to see if it would suit  my  needs,  and  it
  423.            didn't. So I wrote this program, which is much more  powerful
  424.            than  both  Paginate.dme  and  Pager.  In  my   opinion,   it
  425.            completely replaces both.
  426.  
  427.            I originally started writing it in C++, since I want to learn
  428.            that language. But I found that GCC has a bug in  strftime().
  429.            So I converted it to C and used DICE.
  430.  
  431.        DISTRIBUTION
  432.            You may freely distribute this program by any  non-commercial
  433.            means as long as  the  source  code,  this  manual,  and  the
  434.            program are all included together, and no one but myself  has
  435.            made any changes.
  436.  
  437.            It is OK to recompile the source code with another C compiler
  438.            and to redistribute it with the new  executable,  the  source
  439.            code, and this manual. You might do  this,  for  example,  to
  440.            distribute it on machines other than the Amiga. If you do so,
  441.            place a note about what you did in a separate text file.
  442.  
  443.            This program may  not  be  distributed  with  any  commercial
  444.            product without my written permission.
  445.  
  446.            This program may not  be  sold  by  anyone.  But  it  may  be
  447.            included on disks of freely distributable software which sell
  448.            for no more than what Fred Fish charges for  his  disks,  and
  449.            which contain as much freely distributable software  as  they
  450.            can hold.
  451.  
  452.            Fred Fish and DevWare are permitted to include  this  program
  453.            on their disks of freely distributable software.
  454.  
  455.  
  456.        Page 8                                            Tue 27 Apr 1993
  457.  
  458.  
  459.  
  460.        Paginate V1.00             User Manual             Paginate V1.00
  461.  
  462.        DISCLAIMER
  463.            You use this product at your  own  risk.  I,  Fergus  Duniho,
  464.            offer no guarantees that it will suit any of your purposes. I
  465.            do not guarantee the behavior of this program in any way, and
  466.            I cannot be held accountable for any misfortunes that  result
  467.            from the use of this program.
  468.  
  469.        SHAREWARE/FREEWARE
  470.            This program is shareware for some people and freeware for
  471.            others.
  472.  
  473.            For those who write freeware or public  domain  software  for
  474.            the Amiga,  this  is  freeware,  for  they  contribute  their
  475.            efforts to a pool that we become richer by drawing from.
  476.  
  477.            For sysops, this is freeware, for they volunteer  their  time
  478.            and services to make computing all that much richer.
  479.  
  480.            For students and other poor people, this is  freeware,  since
  481.            they can't afford to pay shareware fees for all the shareware
  482.            they might use.
  483.  
  484.            For people who don't live in Canada  or  the  United  States,
  485.            this is freeware, because I don't  want  to  go  through  the
  486.            bother of cashing checks from  foreign  banks  or  exchanging
  487.            foreign money.  But  I  live  close  enough  to  Canada  that
  488.            Canadian money isn't a problem.
  489.  
  490.            For crooks,  pirates,  and  other  immoral  people,  this  is
  491.            freeware, since they wouldn't pay the shareware fee anyway.
  492.  
  493.            For authors of shareware, who do not also write  freeware  or
  494.            public domain software,  this  is  shareware,  for  they  ask
  495.            people to pay for their programs, and so I ask  the  same  of
  496.            them.
  497.  
  498.            For  well-to-do  professionals,  who  do  not   make   unpaid
  499.            contributions to the computing  community  with  programs  or
  500.            services, this is shareware.
  501.  
  502.            For Objectivists, this is shareware, for a  good  Objectivist
  503.            would pay the shareware fee.
  504.  
  505.            For individuals, the shareware  fee  is  $10.00  in  American
  506.            money or $15.00 in Canadian.
  507.  
  508.            For institutions, churches, and mainframes, the shareware fee
  509.            is $20.00 in American money or $30.00 in Canadian.
  510.  
  511.            For the military, the shareware fee is  $500.00  in  American
  512.  
  513.        Page 9                                            Tue 27 Apr 1993
  514.  
  515.  
  516.  
  517.        Paginate V1.00             User Manual             Paginate V1.00
  518.  
  519.            money or $750.00 in Canadian, since the military wouldn't pay
  520.            the shareware fee unless it were exorbitantly high.
  521.  
  522.            You will get nothing in return for your shareware fee  except
  523.            a clean conscience and the knowledge that you  have  made  me
  524.            happy by showing your appreciation for my work.
  525.  
  526.        ETHICAL USE
  527.            You may not use Paginate for any unethical purpose unless you
  528.            pay ten times the shareware fee with clean,  honestly  earned
  529.            money. Stolen or extorted money will not do.  Unethical  uses
  530.            include the pagination of the following sorts of documents:
  531.  
  532.            Propaganda Leaflets for
  533.                Religious Cults
  534.                Hate Groups
  535.                Racial Pride Groups
  536.                Communism
  537.                Fascism
  538.                Nazism
  539.                Socialism
  540.                Nationalism
  541.            Advertisements
  542.            Annoying letters asking for money
  543.            Chain letters
  544.            Smut that degrades women
  545.            Death threats
  546.            Ransom notes
  547.  
  548.            Besides these, there may be unethical uses I haven't  thought
  549.            of.
  550.  
  551.            Ethical uses may include  the  pagination  of  love  letters,
  552.            homework, manuals, programs, newsletters, and other  harmless
  553.            and inoffensive material.
  554.  
  555.        AUTHOR
  556.            The one, the only, the incomparable and humble Fergus Duniho.
  557.  
  558.            You may reach me at the following email address:
  559.            Internet: fdnh@troi.cc.rochester.edu
  560.  
  561.            If you live in the Rochester calling area, you may also  send
  562.            me email on FileWorks, the best Amiga BBS in the area.
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.        Page 10                                           Tue 27 Apr 1993
  570.  
  571.  
  572.  
  573.        Paginate V1.00             User Manual             Paginate V1.00
  574.  
  575.  
  576.            You can send all shareware fees to me at
  577.  
  578.            Fergus Duniho
  579.            1095 Genesee St.
  580.            Rochester, NY 14611
  581.  
  582.            Look for these other fine Amiga software products by me:
  583.  
  584.            The Duniho and Duniho Life Pattern Indicator (DDLI)
  585.            XDME Macros by Duniho (XDMD)
  586.            AlphaSpell - A command line spelling checker
  587.  
  588.            And if you don't use an Amiga, look for the  IBM  version  of
  589.            the DDLI. It's available from the SimTel Software Repository.
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.        Page 11                                           Tue 27 Apr 1993
  625.  
  626.